/*
 * File:   Graph.h
 * Authors: bnoleau, cybourdi, rlecrois
 *
 * Created on 18 octobre 2011, 11:19
 */

#ifndef GRAPH_H
#define	GRAPH_H
#define	DEFAULT_STRATEGY new Glouton()

class Strategy;

#include "builder/Builder.h"
#include "Node.h"

#include <stack>
#include <map>
#include <vector>
#include <ostream>

class Graph {
public:
    Graph(int n);
    virtual ~Graph();
    Node* nodeAt(int i);
    void createEdge(Node* n1, Node* n2);
    void eraseEdgesOfNode(Node* n);
    vector<Node*>* getVertices();
    void addNode(Node* n);
    void toString(ostream &flux);
    int numberOfEdge();
    int numberOfNode();
    Node* getFatherOfLeaf();
    bool hasLeaf();
    void build(Builder *b);
    list<int> launchVertexCover();
    void setStrategy(Strategy *newStrategy);
	
private:
    vector<Node*> *vertices;
    void removeNodeFromList(Node* node, list<Node*> *listnode);
    Strategy *strategy;
};

ostream &operator<<( ostream &flux, Graph& graph);
#endif	/* GRAPH_H */

